﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <link href="~/Content/styles/LeSoft-ui.css" rel="stylesheet" />
    <link href="~/Content/scripts/plugins/fullcalendar/css/fullcalendar.css" rel="stylesheet" />
    <script src="~/Content/scripts/plugins/fullcalendar/js/jquery-1.7.2.min.js"></script>
    <script src="~/Content/scripts/plugins/fullcalendar/js/fullcalendar.min.js"></script>
    <script src="~/Content/scripts/utils/LeSoft-ui.js"></script>
    <script src="~/Content/scripts/plugins/datepicker/WdatePicker.js"></script>
    <script type='text/javascript'>
        $(document).ready(function () {
            resize();
            $('.calendar').fullCalendar({
                header: {
                    left: 'prev,next',
                    center: 'title',
                    right: 'agendaDay,agendaWeek,month'
                },
                monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                dayNamesShort: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
                buttonText: {
                    prev: '上一页',
                    next: '下一页',
                   // select: '计划年月： <input id="Date" type="text" class="input-wdatepicker" value="@LeSoft.Util.Time.GetToday()" placeholder="请输入单据日期" onfocus="WdatePicker()" checkexpession="NotNull" />',
                    month: '月视图',
                    week: '周视图',
                    day: '日视图'
                },
                titleFormat: "yyyy年MM月",
                columnFormat: {
                    month: 'ddd',
                    week: 'MM月dd日 ddd',
                    day: 'MM月dd日 ddd'
                },
                allDayText:'今天',
                axisFormat: "HH:00",
                height: $(window).height() - 55,
                dayClick: function (date, allDay, jsEvent, view) {
                    var _date = $.fullCalendar.formatDate(date, 'yyyy-MM-dd');
                    var _time = $.fullCalendar.formatDate(date, 'HHmm');
                    if (formatDate(_date, 'yyyyMMdd') >= ('@LeSoft.Util.Time.GetToday("yyyyMMdd")')) {
                        btn_add(_date, _time);
                    }
                },
                editable: false,
                eventLimit: true,
                events: (function () {
                    var _data = [];
                    $.ajax({
                        url: "/DailyEventManage/Schedule/GetList",
                        type: "get",
                        dataType: "json",
                        async: false,
                        success: function (data) {
                            _data = data;
                        }
                    });
                    return _data;
                })(),
                eventClick: function (event, element) {  
                    dialogOpen({
                        id: "Form",
                        title: '查看日程',
                        url: '/DailyEventManage/Schedule/Form?keyValue='+event.id,
                        width: "500px",
                        height: "340px",
                        btn:null,
                        callBack: function (iframeId) {
                            top.frames[iframeId].AcceptClick();
                        }
                    });
                }
            });
        });
        function resize() {
            $('#pageayout').height($(window).height() - 20);
            $(window).resize(function (e) {
                window.setTimeout(function () {
                    $('#pageayout').height($(window).height() - 20);
                }, 200);
                e.stopPropagation();
            });
        }
        //添加日程
        function btn_add(date, time) {
            dialogOpen({
                id: "Form",
                title: '添加日程',
                url: '/DailyEventManage/Schedule/Form?startDate=' + escape(date) + '&startTime=' + time,
                width: "500px",
                height: "340px",
                btn: null,
                callBack: function (iframeId) {
                    top.frames[iframeId].AcceptClick();
                }
            });
        }
    </script>
</head>
<body>
    <div id="pageayout" class="border" style="background: #fff; overflow: auto; padding: 0px;">
        <div id='calendar' class="calendar" style="margin: 20px; margin-bottom: 0px;"></div>
    </div>
</body>
</html>
